class Solution:
    def oddEvenList(self, head: ListNode) -> ListNode:
        if head is None:
            return head
        eHead = head.next
        odd = head
        even = eHead

        while even and even.next:
            odd.next = even.next
            odd = odd.next
            even.next = odd.next
            even = even.next

        odd.next = eHead
        return head